using System;
using System.Xml;
using Microsoft.Xna.Framework.Content.Pipeline;

using TImport = System.Xml.XmlDocument;

namespace SilverMenuPipeline
{
	/// <summary>
	/// This class will be instantiated by the XNA Framework Content Pipeline
	/// to apply custom processing to content data, converting an object of
	/// type TInput to TOutput. The input and output types may be the same if
	/// the processor wishes to alter data without changing its type.
	///
	/// This should be part of a Content Pipeline Extension Library project.
	///
	/// TODO: change the ContentProcessor attribute to specify the correct
	/// display name for this processor.
	/// </summary>
	[ContentImporter(".xml", DisplayName = "XNA Silver Menu importer", DefaultProcessor = "SilverMenuPipeline.SilverMenuProcessor")]
	public class SilverMenuImporter : ContentImporter<TImport>
	{
		public override TImport Import(string filename, ContentImporterContext context)
		{
			XmlDocument stringFile = new TImport();
			try
			{
				context.Logger.LogImportantMessage("test");

				stringFile.Load(filename);
			}
			catch (Exception e)
			{
				context.Logger.LogImportantMessage("The file " + filename + " is not valid: " + e.Message);
				throw e;
			}
			return stringFile;
		}
	}
}